package hc.bre.clas

import org.junit.jupiter.api.Test
import hc.Util
import hc.bre.clas.Class9ExcelBuilder

@groovy.transform.TypeChecked
class ExcelClass9Test {

	String getClass9ExcelFileName() {
		getPath()+ "/class9Sample.xlsx"
	}

	String getPath() {
		"src/test/groovy/" + getClass().getPackage().getName().replace('.', '/')
	}

//	@Test
	public void testReadExcelToTable() {

		def table= Class9ExcelBuilder.readExcel(getClass9ExcelFileName())

		assert table.size() == 	7

		assert table[0][0] == '变量分类'

		assert table[6][2] == '999'

		//println JsonUtil.json2Text(table)
	}


//	@Test
//	public void testTable2Definition() {
//		def text=
//				'''
//[["变量分类","年龄风险分类"],
//["引用数据","基本信息.年龄"],
//["名称","范围","编号"],
//["青年","18..30","1"],
//["壮年","31..<41","2"],
//["中年","41..65","3"],
//["禁止","其它","999"]]
//'''
//		def table= Util.jsonRead(text)
//
//		def c9d = Class9ExcelBuilder.table2Definition(table as ArrayList)
//
//		assert c9d.rname == '年龄风险分类'
//		assert c9d.variableId =='基本信息.年龄'
//		assert c9d.list[3].id == 999
//	}
}
